<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let money = 100
    while (true) {
      let atm = +prompt(`
      ------ATM机------
      1.存款
      2.取款
      3.查看余额
      4.退出
      请输入你要操作的数字:
      `)

      if (atm === 4) {
        break
      }

      switch (atm) {
        case 1:
          let cun = +prompt('请输入你的存款金额:')
          money = money + cun
          alert(`恭喜你，存款成功!余额为${money}￥`)
          break;
        case 2:
          let qu = +prompt('请输入你的取款金额:')
          if (qu > money) {
            alert('对不起，你的余额不足')
          }
          else if (qu < money) {
            money = money - qu
            alert(`恭喜你，取款成功!余额为${money}￥`)
          }
          else if (qu = money) {
            money = money - qu
            alert(`取款成功，余额为${money}￥，恭喜你又成为穷光蛋了哦!`)
          }
          break;
        case 3:
          alert(`你的银行卡余额为${money}元`)
          break
      }
    }


  </script>
</body>

</html>